/*
 * @message: 描述
 * @Author: Roy
 * @Email: cx_love_xc@163.com
 * @Github: cx_love_xc@163.com
 * @Date: 2022-01-14 16:05:30
 * @LastEditors: Roy
 * @LastEditTime: 2022-01-16 18:56:35
 * @Deprecated: 否
 * @FilePath: /blog/src/admin/container/store/action.js
 */
import { CHANGE_SCHEMA, ADD_PAGE_CHILDREN, CHANGE_PAGE_CHILD, DELETE_PAGE_CHILD, CHANGE_PAGE_CHILD_POSITION, CHANGE_PAGE_ATTRIBUTE } from './constant'

export const getChangeSchemaAction = (schema) => {
    return {
        type: CHANGE_SCHEMA,
        value: schema
    }
}

export const addPageChildrenAction = () => {
    return {
        type: ADD_PAGE_CHILDREN,
        value: {}
    }
}


export const getChangePageChildAction = (index, value) => {
    return {
        type: CHANGE_PAGE_CHILD,
        index,
        value
    }
}

export const getDeletePageChildAction = (index) => {
    return {
        type: DELETE_PAGE_CHILD,
        index,
    }
}

export const getChangePageChildPositionAction = (oldIndex, newIndex) => {
    return {
        type: CHANGE_PAGE_CHILD_POSITION,
        oldIndex,
        newIndex
    }
}

export const getChangePageAttributeAction = (key, value) => {
    return {
        type: CHANGE_PAGE_ATTRIBUTE,
        key,
        value,
    }
}